package com.cooper.service.item;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooper.dao.item.ItemSkuDAO;
import com.cooper.entity.ItemSku;

@Service
public class ItemSkuService {
	
	@Autowired
	private ItemSkuDAO itemSkuDao;
	
	public List<ItemSku> getItemSkuListByItemId(long itemId) throws Exception{
		return this.itemSkuDao.getItemSkuListByItemId(itemId);
	}
	
	public ItemSku getItemSkuByItemIdAndPropKey(Long itemId, String propKey) throws Exception{
		return this.itemSkuDao.getItemSkuByItemIdAndPropKey(itemId, propKey);
	}
	
	public ItemSku loadById(long id) throws Exception{
		return this.itemSkuDao.loadById(id);
	}
	
	public Long saveEntity(ItemSku sku) throws Exception{
		return this.itemSkuDao.saveEntity(sku);
	}
	
	public boolean updateEntity(ItemSku sku) throws Exception{
		return this.itemSkuDao.updateEntity(sku);
	}
	
	public void deleteSkusNotUsedByItemId(long itemId, Collection<Long> skuIdList){
		this.itemSkuDao.deleteSkusNotUsedByItemId(itemId, skuIdList);
	}

}
